/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gradius.InterfaceGrafica;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import javax.swing.JButton;
import javax.swing.JPanel;

/**
 *
 * @author Eduardo
 */
public class Sobre extends JPanel
{
    private Image fundo;
    private JPanel painel;
    private JButton botao;
    private Janela5 frame;

    public Sobre(Janela5 frame)
    {
        this.frame = frame;
        botao = new JButton("Voltar");
        botao.addActionListener(new OuvinteBotao());
        painel = new JPanel(new FlowLayout());
        painel.add(botao);
        painel.setOpaque(false);
        this.setLayout(new BorderLayout());
        this.add(painel,BorderLayout.SOUTH);
        String caminho = "/images/backgrounds/sobre.png";
        URL url = PainelMenu.class.getResource(caminho);
        fundo = Toolkit.getDefaultToolkit().getImage(url);
    }

    @Override
    protected void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D)g;
        g2.drawImage(fundo,0,0, this);
    }

    public class OuvinteBotao implements ActionListener
    {
        /** Método responsavel pela resposta ao evento de clique selecionado
         *
         * @param e - Objeto do evento capturado no clique do botão
         */
        public void actionPerformed(ActionEvent e)
        {
            frame.dispose();
        }
    }
}
